<?
	session_start();
	include("./connection");
	$connection=mysql_connect($server, $user, $passwd);
	$db= mysql_select_db($name_db, $connection);
	$sql="select email,passwd,id_tipus from login where email='".$_REQUEST["email"]."'";
	$rs=mysql_query($sql, $connection) or die header("Location: ./login.php?e=2");
	$row=mysql_fetch_array($rs);
	if($row["passwd"]==$_REQUEST["passwd"]) {
			$_SESSION["USER"]=$row["email"];
			$_SESSION["ID_TIPUS"]=$row["id_tipus"];
			header("Location: ./index.php");
	} else { header("Location: ./login.php?e=1");}
	
?>